package features.word_counter;


import java.util.ArrayList;

import dictionary.Dictionary;



public class BodyAndTitleWordCounter extends WordCounter {
	
	private WordCounter bodywc,titlewc;
	
	private int title_weight;
	
	public BodyAndTitleWordCounter(Dictionary dict, int title_weight) {
		super(dict);
		bodywc = new BodyWordCounter(dict);
		titlewc = new TitleWordCounter(dict);
		this.title_weight = title_weight;
	}

	@Override
	public ArrayList<String> getAllWords(String line) {
		ArrayList<String> title_words = titlewc.getAllWords(line);
		ArrayList<String> res = new ArrayList<String>();
		for ( int i = 0 ; i < title_weight ; ++i ) {
			res.addAll(title_words);
		}
		res.addAll(bodywc.getAllWords(line));
		return res;
	}
	
}
